package com.cloud.base.config;

import com.cloud.api.domain.sys.GlobalDataPermit;
import com.cloud.base.service.IGlobalDataPermitService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;

import java.util.List;

@Slf4j
@Component
@Order(4)
public class GlobalPermitRunner implements CommandLineRunner {

    @Resource
    private IGlobalDataPermitService globalDataPermitService;
    @Resource(name = "myRedis")
    private RedisTemplate<String,Object> redisTemplate;

    @Override
    public void run(String... args) throws Exception {
   /*     List<GlobalDataPermit> list = globalDataPermitService.list();
        List<String> funIds = list.stream().map(GlobalDataPermit::getFunId).toList();
        if (!funIds.isEmpty()){
            for (String funId : funIds){
                redisTemplate.opsForSet().add("spring_cache_funIds",funId);
            }
        }*/
    }
}
